package net.apexes.demo.codegen.querydsl.qvar;

import static com.querydsl.core.types.PathMetadataFactory.*;
import com.querydsl.core.types.dsl.*;

import java.sql.Types;
import javax.annotation.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.PathMetadata;
import com.querydsl.sql.ColumnMetadata;
import com.querydsl.sql.PrimaryKey;
import net.apexes.commons.querydsl.Index;
import net.apexes.demo.codegen.querydsl.entity.Brand;
import net.apexes.demo.codegen.querydsl.qvar.base.QEntityBase;

/**
 * QBrand is a Querydsl query type for Brand
 */
@Generated("net.apexes.codegen.core.MetadataSerializer")
public class QBrand extends QEntityBase<Brand> {

    private static final long serialVersionUID = -142760692;

    public static final QBrand $ = new QBrand("BRAND");

    public final StringPath sn = createString("sn");

    public final StringPath name = createString("name");

    public class PrimaryKeys {

        public final PrimaryKey<Brand> constraint3c = createPrimaryKey(id);

    }

    public final PrimaryKeys pk = new PrimaryKeys();

    public class Indexs {

        public final Index constraintIndex3 = index("CONSTRAINT_INDEX_3").unique().column(sn).build();

        public final Index primaryKey3 = index("PRIMARY_KEY_3").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QBrand(String variable) {
        super(Brand.class, forVariable(variable), "PUBLIC", "BRAND");
        addMetadata();
    }

    public QBrand(String variable, String schema, String table) {
        super(Brand.class, forVariable(variable), schema, table);
        addMetadata();
    }

    public QBrand(Path<? extends Brand> path) {
        super(path.getType(), path.getMetadata(), "PUBLIC", "BRAND");
        addMetadata();
    }

    public QBrand(PathMetadata metadata) {
        super(Brand.class, metadata, "PUBLIC", "BRAND");
        addMetadata();
    }

    public void addMetadata() {
        addMetadata(id, ColumnMetadata.named("ID").withIndex(1).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(sn, ColumnMetadata.named("SN").withIndex(2).ofType(Types.VARCHAR).withSize(16).notNull());
        addMetadata(name, ColumnMetadata.named("NAME").withIndex(3).ofType(Types.VARCHAR).withSize(32).notNull());
        addMetadata(statusFlag, ColumnMetadata.named("STATUS_FLAG").withIndex(4).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(version, ColumnMetadata.named("VERSION").withIndex(5).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(crtTime, ColumnMetadata.named("CRT_TIME").withIndex(6).ofType(Types.TIMESTAMP).withSize(26).withDigits(6).notNull());
        addMetadata(crtWho, ColumnMetadata.named("CRT_WHO").withIndex(7).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(updTime, ColumnMetadata.named("UPD_TIME").withIndex(8).ofType(Types.TIMESTAMP).withSize(26).withDigits(6));
        addMetadata(updWho, ColumnMetadata.named("UPD_WHO").withIndex(9).ofType(Types.VARCHAR).withSize(22));
    }

    @Override
    public Brand newEntity() {
        return new Brand();
    }

    @Override
    public Object getFieldValue(Brand entity, String fieldName) {
        switch (fieldName) {
            case "id":
                return entity.getId();
            case "sn":
                return entity.getSn();
            case "name":
                return entity.getName();
            case "statusFlag":
                return entity.getStatusFlag();
            case "version":
                return entity.getVersion();
            case "crtTime":
                return entity.getCrtTime();
            case "crtWho":
                return entity.getCrtWho();
            case "updTime":
                return entity.getUpdTime();
            case "updWho":
                return entity.getUpdWho();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(Brand entity, String fieldName, Object value) {
        switch (fieldName) {
            case "id":
                entity.setId((java.lang.String) value);
                break;
            case "sn":
                entity.setSn((java.lang.String) value);
                break;
            case "name":
                entity.setName((java.lang.String) value);
                break;
            case "statusFlag":
                entity.setStatusFlag((net.apexes.demo.codegen.entity.enums.StatusFlag) value);
                break;
            case "version":
                entity.setVersion((java.lang.String) value);
                break;
            case "crtTime":
                entity.setCrtTime((java.time.LocalDateTime) value);
                break;
            case "crtWho":
                entity.setCrtWho((java.lang.String) value);
                break;
            case "updTime":
                entity.setUpdTime((java.time.LocalDateTime) value);
                break;
            case "updWho":
                entity.setUpdWho((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

